
#pragma once

class TcpPortTestActiveConnectionActorMgr : public ActorMgrBase
{
public:
	TcpPortTestActiveConnectionActorMgr(std::size_t _workerPoolSize = 1);
	virtual ~TcpPortTestActiveConnectionActorMgr();

	virtual retT makeActor(boost::shared_ptr<ActorBase>& _pActor);
	virtual retT start();
};

class TcpPortTestActiveConnectionActor : public ActorBase, public virtual ITcpAction
{
public:
	TcpPortTestActiveConnectionActor();
	virtual ~TcpPortTestActiveConnectionActor();

	virtual retT start();
	virtual retT init();

	virtual retT onRead( boost::shared_ptr<DataHandlerContext> _pDataHandlerContext, std::size_t _bytesTransferred, const boost::system::error_code& e, std::size_t _timeoutCount);
	virtual retT onWrite( boost::shared_ptr<DataHandlerContext> _pDataHandlerContext, std::size_t _bytesTransferred,const boost::system::error_code& e, std::size_t _timeoutCount);
	virtual retT onConnect( boost::shared_ptr<DataHandlerContext> _pDataHandlerContext, const boost::system::error_code& e, std::size_t _timeoutCount);

	virtual retT onError(retT errorNo);
	int numToEcho_;

protected:
	std::string serverIP_;
	unsigned short serverPort_;
	bool doConnect_;
	boost::shared_ptr<TcpHandler> pTcpConnectionHandler;
};
